import java.util.Scanner;

public class ForLoop
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);//使用Scanner类
        System.out.print("Enter n: ");
        long n = in.nextInt();//定义阶乘的大小*/

        if (n < 0)
        {
            System.out.print("Please input a positive number");
            return;
        }
        Factorial(n);
    }

    public static void Factorial(long n)
    {
        long fo = 0;
        for (int i = 0; i <= n; i++) {
            if (i <= 1) {
                fo = 1;
                System.out.println(i + "! = " + fo);
            } else {
                fo = i * fo;
                System.out.println(i + "! = " + fo);
            }
        }
    }
}